package apiday08.homework;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class Test {
    public static void main(String[] args) throws Exception {
        Class<?> cls = Class.forName("apiday08.homework.Person");
        Object obj = cls.newInstance();
        Method[] methods = cls.getMethods();
        for (Method method : methods){
            if(method.getParameterCount()==0 && method.getModifiers()== Modifier.PUBLIC){
                System.out.println("public且无参的方法："+method.getName());
                method.invoke(obj);
            }
        }
        for (Method method : methods){
            if (method.isAnnotationPresent(AutoRunMethod.class)){
                System.out.println(method.getName()+"被注解注释");
                method.invoke(obj);
            }
        }
    }
}
